<template>
  <div class="comment">
    <div class="d1">
      <span style="margin-left: 10px">全部留言 ({{ comment.length }})</span>
      <span style="margin-left: 178px">赞 3</span>
      <div class="item" v-for="(item, i) of comment" :key="i">
        <div class="avatar">
          <img :src="require(`../../public/${item.avatar}`)" alt="" />
        </div>
        <div class="user" v-html="item.user"></div>
        <div class="more">...</div>
        <div class="content" v-html="item.content"></div>
        <div class="time">{{ item.time }}</div>
        <mt-button class="btn" size="small">回复</mt-button>
      </div>
    </div>

    <div class="foot">
      <input type="text" placeholder="写留言" @focus="messageBox" />
      <div class="good">
        <van-icon name="good-job-o" />
        <!-- <img src="../../public/good.jpg" alt="" /> -->
        <span>点赞</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      comment: [
        {
          avatar: "2.jpeg",
          user: "马冬梅",
          content: "周围环境挺不错的,隔音比较好",
          time: "2020-12-5 12:54:32",
        },
        {
          avatar: "3.jpeg",
          user: "悠悠",
          content: "楼上的",
          time: "2020-12-5 12:54:32",
        },
      ],
    };
  },
  methods: {
    messageBox() {
      this.$messagebox({
        $type: "prompt",
        message: " ",
        showInput: true,
        inputPlaceholder: "想对Ta说点什么",
        showConfirmButton: true,
        showCancelButton: true,
      })
        .then(({ value, action }) => {
          console.log(value);
        })
        .catch(() => {});
    },
  },
};
</script>
<style>
.comment .d1 {
  width: 362px;
  height: 500px;
  margin-top: 20px;
  margin-left: 7px;
  padding: 6px;
  padding: 10px;
  margin-bottom: 20px;
  background-color: #fff;
}
.comment .item {
  position: relative;
  margin-top: 40px;
  margin-bottom: 20px;
}
.comment .avatar img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  margin-left: 10px;
  background-repeat: no-repeat;
  background-size: contain;
}
.comment .user {
  max-width: 150px;
  font-size: 19px;
  position: absolute;
  top: 2px;
  left: 70px;
}
.comment .user span{
  font-size: 23px;
  font-weight: 600;
  margin-left: 10px;
}
.comment .more {
  position: absolute;
  right: 10px;
  top: -15px;
  font-size: 34px;
  margin-right: 10px;
}
.comment .content {
  margin-left: 70px;
  background-color:#FFF;
  padding: 10px 0;
  font-size: 20px;
  border-radius: 5px;
  
}
/* .comment .content .span{
  color: red;
} */
.comment .time {
  float: left;
  margin-left: 70px;
  margin-top: 10px;
  color: gray;
  font-size: 16px;
}
.comment .btn {
  float: left;
  margin-left: 10px;
  margin-top: 5px;
  margin-bottom: 2px;
}
.comment .foot {
  position: fixed;
  bottom: 0px;
  width: 100%;
  height: 50px;
  background-color: #fff;
}
.comment .foot input {
  margin-left: 5%;
  width: 70%;
  height: 30px;
  outline: none;
  border:0;
  background-color: rgb(206, 206, 206);
  border-radius: 18px;
  padding-left: 10px;
}
.comment .good {
  position: absolute;
  right: 25px;
  top: 3px;
}
.comment .good .van-icon {
  /* width: 25px;
  float: left; */
  margin-top: 2px;
  width: 10px;
}
.comment .good span {
  display: block;
  float: left;
  margin-top: 0px;
  font-size: 1rem;
  color: rgb(92, 89, 89);

}

</style>